<?php
/**
 * @copyright  For copyright and license information, read the COPYING.txt file.
 * @link       /COPYING.txt
 * @license    Academic Free License (AFL 3.0)
 * @package     default_default
 */
?>
<?php
/** @var Mage_Core_Block_Template $this */
?>
<!DOCTYPE html>
<html lang="<?php echo $this->getLang() ?>">
<head>
<?php echo $this->getChildHtml('head') ?>
<style type="text/css">
    html,body { height:100%; }
</style>
</head>
<body id="html-body" style="background:#fff;">
<div id="preview" class="cms-revision-preview">
    <div class="toolbar">
        <?php if (!Mage::app()->isSingleStoreMode()) :?>
        <p class="switcher">
            <?php echo $this->getChildHtml('store_switcher') ?>
            <button class="button" onclick="preview();"><span><span><span><?php echo $this->__('Preview'); ?></span></span></span></button>
        </p>
        <?php endif ?>
    </div>
    <iframe name="preview_iframe" id="preview_iframe" frameborder="0"></iframe>
    <?php echo $this->getChildHtml('preview_form'); ?>
</div>
<div id="loading-mask" style="display:none">
    <div class="backdrop"></div>
    <p class="loader" id="loading_mask_loader">
        <img src="<?php echo $this->getSkinUrl('images/ajax-loader-tr.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('adminhtml')->__('Loading...')) ?>"/><br/><?php echo Mage::helper('adminhtml')->__('Please wait...') ?>
    </p>
</div>

<script type="text/javascript">
//<![CDATA[
var previewForm = $('preview_form');
var previewIframe = $('preview_iframe');

function preview() {
    previewForm.writeAttribute('target', previewIframe.readAttribute('id'));
    blockPreview();
    previewForm.submit();
}

function blockPreview() {
    showLoader($('preview'));
}

function unBlockPreview() {
    hideLoader();
}

Event.observe(window, 'load', preview);
Event.observe(previewIframe, 'load', unBlockPreview);
//]]>
</script>
</body>
</html>
